package demo.pattern.proxy.impl;

import demo.pattern.proxy.ToBPayment;

/**
 * @ClassName AlipayToB
 * @Description
 * @Author 47980
 * @Date 2020/8/9 15:29
 * @Version V_1.0
 **/
public class AlipayToB implements ToBPayment {
    private ToBPayment toBPayment;

    public AlipayToB(ToBPayment toBPayment) {
        this.toBPayment = toBPayment;
    }
    @Override
    public void pay() {
        beforePay();
        toBPayment.pay();
        afterPay();
    }

    private void beforePay() {
        System.out.println("从招行里取款");
    }

    private void afterPay() {
        System.out.println("支付给B");
    }
}
